<?php
/**
 * Created by PhpStorm.
 * User: wangye
 * Date: 19-2-14
 * Time: 下午6:40
 */

//链接服务端
$conn = stream_socket_client("tcp://0.0.0.0:8000",$errno,$errstr,1);#协议 ,错误号,错误信息,超时

if (!$conn){
    echo "errstr($errno)\n";
}else{
    //向服务端发送内容
    stream_socket_sendto($conn,"this is clientO(∩_∩)O哈哈哈~\n");
    //接收服务端数据
    echo stream_get_contents($conn);
    fclose($conn);
}
